
package messaging;

import java.io.Serializable;
/**
 * This class encapsulates the channel represented by each blocking queue ( channel)
 * with information on the source node, destination node and the actual blocking queue 
 * connecting them.
 */
import java.util.concurrent.LinkedBlockingQueue;

public class ChannelQueue
{
  /**
   * source node number.
   */
  private int source_node_num;
  /**
   * destination node number.
   */
  private int dest_node_num;
  /**
   * A blocking queue connecting this source to this destination.
   */
  private LinkedBlockingQueue<InterNodeMessage> my_queue;
  /**
   * Constructor initializing the source and destination node numbers.
   */
  public ChannelQueue(int source_node, final int dest_node)
  {
    this.source_node_num = source_node;
    this.dest_node_num = dest_node;
    my_queue = new LinkedBlockingQueue<InterNodeMessage>();
  }
  /**
   * Gets the source node number.
   * @return int - the source node number.
   */
  public int getSouceNodeNumber()
  {
    return this.source_node_num;
  }
  /**
   * Gets the destination node number.
   * @return int - the destination node number.
   */
  public int getDestNodeNumber()
  {
    return this.dest_node_num;
  }
  /**
   * Returns the queue that this channel holds.
   * @return LinkedBlockingQueue - the actual queue.
   */
  public LinkedBlockingQueue<InterNodeMessage> getQueue()
  {
    return this.my_queue;
  }
}
